package com.xsm.adapter;
import java.util.ArrayList;
import com.xsm.activitygroup.R;
import com.xsm.object.UserObject;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class UserMessageAdapter extends BaseAdapter{
ArrayList<String> ms;
Context context;
LayoutInflater layoutInflater;
ViewHolder viewHolder;
ArrayList<String> types;
public UserMessageAdapter(Context context,ArrayList<String> types,ArrayList<String> ms){
	this.ms=ms;
	this.context=context;
	this.types=types;
	layoutInflater=LayoutInflater.from(context);
}
	public int getCount() {
		return types.size();
	}

	@Override
	public Object getItem(int arg0) {
		return types.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	public View getView(int arg0, View arg1, ViewGroup arg2) {
		viewHolder=new ViewHolder();
		if(arg1==null){
			arg1=layoutInflater.inflate(R.layout.messageitem,null);
			viewHolder.mstypeTextView=(TextView)arg1.findViewById(R.id.mstype);
			viewHolder.msTextView=(TextView)arg1.findViewById(R.id.ms);
			arg1.setTag(viewHolder);		
		}else {	
			viewHolder=(ViewHolder)arg1.getTag();
		}
		viewHolder.mstypeTextView.setText(types.get(arg0));
	    viewHolder.msTextView.setText(ms.get(arg0));
		return arg1;
	}
	
	class ViewHolder{
		TextView mstypeTextView;
		TextView msTextView;
	}

}	
